const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('scrip', {
    id: {
      autoIncrement: true,
      type: DataTypes.INTEGER,
      allowNull: false,
      primaryKey: true,
      comment: "纸条id"
    },
    scrip_content: {
      type: DataTypes.STRING(255),
      allowNull: false,
      comment: "纸条内容"
    },
    wechat: {
      type: DataTypes.STRING(255),
      allowNull: false,
      comment: "微信号"
    },
    user_id: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: "放入纸条的用户id"
    },
    destroy_num: {
      type: DataTypes.INTEGER,
      allowNull: true,
      defaultValue: 1,
      comment: "多少次获取后销毁"
    },
    audit: {
      type: DataTypes.STRING(1),
      allowNull: true,
      defaultValue: "1",
      comment: "审核状态，1为未审核，2为审核通过，3为审核不通过"
    },
    audit_content: {
      type: DataTypes.STRING(50),
      allowNull: true,
      comment: "当审核不通过后需告知原因"
    },
    sex_status: {
      type: DataTypes.STRING(1),
      allowNull: false,
      comment: "纸条的类别：0女 1男"
    },
    scrip_status: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "纸条状态"
    },
    area: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "所选择在的区域"
    },
    create_time: {
      type: DataTypes.DATE,
      allowNull: false,
      comment: "创建时间"
    }
  }, {
    sequelize,
    tableName: 'scrips',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "id" },
        ]
      },
    ]
  });
};
